package com.scribbles.article.dao;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Query;

import org.springframework.stereotype.Repository;

import com.scribbles.common.dao.AbstractDAO;
import com.scribbles.common.entity.Article;

@Repository
public class ArticleDAO extends AbstractDAO<Article, Serializable>{
	public ArticleDAO()  {
		super(Article.class);
	}

	public List<Article> retrieveArticlesForUserId(String userId) {
		Query query = em.createNamedQuery("retrieveArticlesForUserId");
		query.setParameter("userId", userId);
		return query.getResultList();
	}

	public List<Article> getArticlesListForHeader(Integer articleHeaderId) {
		Query query = em.createNamedQuery("getArticlesListForHeader");
		query.setParameter("articleHeaderId", articleHeaderId);
		return query.getResultList();
	}
}